<?php
define("GPIO_INPUT", 0);
define("GPIO_OUTPUT", 1);
define("PWM_OUTPUT", 2);
define("GPIO_CLOCK", 3);


define("GPIO_PUD_UP", 2);
define("GPIO_PUD_DOWN", 1);
define("GPIO_PUD_OFF", 0);


define("GPIO_HIGH", 1);
define("GPIO_LOW", 0);

define("PWM_MODE_BAL", 1);
define("PWM_MODE_MS", 0);

define("GPIO_MODE_READ", 0);
define("GPIO_MODE_SET", 1);
define("GPIO_MODE_CLR", 2);
define("GPIO_MODE_INPUT_READ", 3);


define("CAN_EFF_FLAG",  0x80000000);//0x80000000U
define("CAN_RTR_FLAG",  0x40000000);//0x40000000U
define("CAN_ERR_FLAG",  0x20000000);//0x20000000U

define("CAN_SFF_MASK",  0x000007FF);//0x000007FFU
define("CAN_EFF_MASK",  0x1FFFFFFF);//0x1FFFFFFFU
define("CAN_ERR_MASK",  0x1FFFFFFF);//0x1FFFFFFFU

define("CAN_TYPE_STANDARD", 0);
define("CAN_TYPE_EXTEND", 1);

function gpio_bcm_pin_reset(){}

/**
 * pin_no: bcm pin number
 * pin_mode: GPIO_MODE_READ, GPIO_MODE_SET, GPIO_MODE_CLR, GPIO_MODE_INPUT_READ
 * pull: GPIO_PUD_UP, GPIO_PUD_DOWN, GPIO_PUD_OFF
 *
 * @return integer
 *   0 for ok
 *   -1 for bcm2835_init error
 *   -2 for mode error
 */
function gpio_bcm_pin_ctrl(){}


/**
 * can
 */

function can_init($can_device, $bit_rate){}

function can_open($can_device){}


function can_send($socket_id, $can_id, $can_id_type, $can_data){}

/**
 * @deprecated 不建议使用， 建议使用candump代替
 * @param $socket_id
 */
function can_read($socket_id){}

function can_close($socket_id){}

function can_uninit($can_device){}


//core functions
function wpiPinMode($pin, $mode){}

function wpiPullUpDnControl($pin, $pud){}

function wpiDigitalWrite($pin, $value){}

function wpiPwmWrite($pin, $value){}

function wpiDigitalRead($pin){}

function wpiAnalogRead($pin){}

function wpiAnalogWrite($pin, $value){}